import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router);

import Home from '../components/Home'
import Course from '../components/Course'
import Cart from '../components/Cart'
import Detail from '../components/Detail'
import Login from '../components/Login'
import Register from '../components/Register'
// import Order from '../components/Order'
import Order from '@/components/Order'
// import Success from '../components/Success'
// import UserOrder from '../components/user/Order'


// 解决Element-ui多次点击路由报错
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};

export default new Router({
  mode: 'history',

  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/home',
      name: 'home',
      component: Home
    },
    {
      path: '/course',
      name: 'course',
      component: Course
    },
    {
      path: '/cart',
      name: 'cart',
      component: Cart
    },
    {
      path: '/course/:id',
      name: 'detail',
      component: Detail
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
    {
      path: '/buy',
      name: 'order',
      component: Order
    },
    // {
    //   path: '/pay/result',
    //   name: 'success',
    //   component: Success
    // },
    // {
    //   path: '/user/order',
    //   name: 'userorder',
    //   component: UserOrder
    // }
  ]
});








